local skel = fk.CreateSkill{
  name = "lb__zhangyan",
}

Fk:loadTranslationTable{
["lb__zhangyan"] = "掌宴",
[":lb__zhangyan"] = "当你发动<a href=':lb__qiujing'><font color='red'>〖囚境〗</font></a>时，你可以弃置至多三张牌并从“是”多、“否”多中预测一项，若预测：<br>"..
"正确：〖囚境〗最大目标数+1，你摸弃牌数两倍的牌；<br>"..
"不正确：重置〖囚境〗，下次发动〖囚境〗时你成为额外目标。",

["#lb__zhangyan"] = "掌宴：你可以弃置至多三张牌并预测〖囚境〗",

["$lb__zhangyan1"] = "买定离手，全押。",
["$lb__zhangyan2"] = "赌局还未结束，重码加注咯。",
}

skel.extra.choiceFilter = function(cards, choice, extra_data)
  return #cards > 0 and #cards < 4
end

skel:addEffect(fk.SkillEffect, {
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and data.who == player and data.skill.name == "lb__qiujing" then
      if player:getMark("@@lb__qiujing") > 0 then
        table.insertIfNeed(data.skill_data.tos,player)
        player.room:setPlayerMark(player,"@@lb__qiujing",0)
      end
      return not player:isNude()
    end
  end,
  on_cost = function (self, event, target, player, data)
    local cs = table.filter(player:getCardIds("he"),function (id)
      return not player:prohibitDiscard(id)
    end)
    if #cs == 0 then return end
    local cards,choice = Room:askToChooseCardsAndChoice(player,{
      cards = cs,
      skill_name = skel.name,
      prompt = "#lb__zhangyan",
      choices = {"yes","no"},
      cancel_choices = {"Cancel"},
      min_num = 1,
      max_num = 3,
      all_cards = player:getCardIds("he"),
      filter_skel_name = skel.name,
    })
    if choice ~= "Cancel" then
      event:setCostData(self,{cards = cards,choice = choice})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cost_data = event:getCostData(self)
    local choice = cost_data.choice
    local cards = cost_data.cards
    room:throwCard(cards,"lb__zhangyan",player,player)
    room:setTag("lb__zhangyan",{choice = choice,n = (2 * #cards)})  --暂时先这样
  end,
  
})

return skel